#ifndef NOTEOUT
#define NOTEOUT
#include <stdio.h>
#include "note.h"
extern Note_by_time *time_head;
extern int note_number;
void delete_tag(Tag_list *tag){//删除标签
    Tag_list *node=tag_head;
    while(node->tag_next!=tag)
        node=node->tag_next;
    node->tag_next=tag->tag_next;
    free(tag);
    return ;
}
void delete_note_in_tag(wchar_t *tag,Note *note){//删除标签下链表中的该笔记
    Tag_list *tag_node=tag_head->tag_next;
    while(wcscmp(tag_node->tag,tag))
        tag_node=tag_node->tag_next;
    Note_list *note_node=tag_node->note_list;
    if(note==note_node->note){
        Note_list *des=note_node;
        tag_node->note_list=note_node->next;
        free(des);
    }
    else{
        while(note!=note_node->next->note)
            note_node=note_node->next;
        note_node->next=note_node->next->next;
    }
    if(tag_node->note_list==NULL)
        delete_tag(tag_node);
    return ;
}
void put_one_note(Note* note){
    wprintf(L"title:%ls\t\t", note->title);
    wprintf(L"%d/%d/%d ", note->date / 10000, note->date / 100 % 100, note->date % 100);
    wprintf(L"%d:%02d\n", note->time / 100, note->time % 100);
    wprintf(L"tags:");
    for(int i=0;i<note->tag_number;i++)
        wprintf(L"#%ls# ", note->tag[i]);
    wprintf(L"\nNote: %ls\n\n", note->note);
}
#endif